package com.comtime.mybox;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.ToggleButton;

import com.comtime.smartbox.BaseActivity;
import com.comtime.smartkilimanjaro.R;
import com.comtime.utils.MySharedPreferences;

public class OpenBoxPwdManagerActivity extends BaseActivity {

	ImageView image_finge,image_hand;
	MySharedPreferences mySharedPreferences;
	ToggleButton tb_wrong_pwd;//输入错误密码音乐开关
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_set_openbox_pwdmanager);
		mySharedPreferences=MySharedPreferences.getInstance(this);
		init();
	}
	
	void init(){
		image_finge=(ImageView) findViewById(R.id.image_fingerprint_pwd);
		image_hand=(ImageView) findViewById(R.id.image_hand_print_pwd);
		
		
		if(mySharedPreferences.getFingerPrintPwdCheck()){
			image_finge.setVisibility(View.VISIBLE);
		}else{
			image_finge.setVisibility(View.INVISIBLE);
		}
		
		
		if(mySharedPreferences.getGesturePwdCheck()){
			image_hand.setVisibility(View.VISIBLE);
		}else{
			image_hand.setVisibility(View.INVISIBLE);
		}
		
		tb_wrong_pwd=(ToggleButton) findViewById(R.id.tb_wrong_pwd);
	}
	
	public void BackAction(View v) {
		this.finish();
		overridePendingTransition(R.anim.enter_left, R.anim.exit_right);
	}
	
	public void FingeAction(View v) {
		if(mySharedPreferences.getFingerPrintPwdCheck()){
			image_finge.setVisibility(View.INVISIBLE);
			mySharedPreferences.saveFingerPrintPwdCheck(false);
		}else{
			image_finge.setVisibility(View.VISIBLE);
			mySharedPreferences.saveFingerPrintPwdCheck(true);
		}
		
		
	}
	public void HandAction(View v) {
		if(mySharedPreferences.getGesturePwdCheck()){
			image_hand.setVisibility(View.INVISIBLE);
			mySharedPreferences.saveGesturePwdCheck(false);
		}else{
			image_hand.setVisibility(View.VISIBLE);
			mySharedPreferences.saveGesturePwdCheck(true);
		}
	}
	public void BoxManagerAction(View v) {
		Intent intent=new Intent(this, FingerprintManagerActivity.class);
		startActivity(intent);
	}
	public void PwdWrongMusicAction(View v) {
		Intent intent=new Intent(this, SelectVoiceActivity.class);
		intent.putExtra("selectType", 3);
		startActivity(intent);
	}
	
	
	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
	}
}
